package com.woniu.goodsservice.service.impl;

import com.woniu.goodsservice.entity.Goodsdetail;
import com.woniu.goodsservice.dao.GoodsdetailDao;
import com.woniu.goodsservice.service.GoodsdetailService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("goodsdetailService")
public class GoodsdetailServiceImpl implements GoodsdetailService {
    @Resource
    private GoodsdetailDao goodsdetailDao;

    @Override
    public Goodsdetail queryById(Integer id) {
        return goodsdetailDao.queryById(id);
    }

    @Override
    public List<Goodsdetail> queryAllByLimit(int offset, int limit) {
        return goodsdetailDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Goodsdetail> findAll() {
        return goodsdetailDao.findAll();
    }

    @Override
    public Goodsdetail insert(Goodsdetail goodsdetail) {
        goodsdetailDao.insert(goodsdetail);
        return goodsdetail;
    }

    @Override
    public Goodsdetail update(Goodsdetail goodsdetail) {
        goodsdetailDao.update(goodsdetail);
        return queryById(goodsdetail.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return goodsdetailDao.deleteById(id) > 0;
    }
}